package com.crazy.crazyproductservice.controller.inner;

import com.crazy.crazymodel.model.entity.Product;
import com.crazy.crazyproductservice.mapper.ProductMapper;
import com.crazy.crazyproductservice.service.ProductService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * ProductInnerController
 *
 * @author 13259
 * @version 2024/05/10 18:34
 **/
@RestController
@RequestMapping("/inner")
public class ProductInnerController {

    @Resource
    private ProductService productService;

    @GetMapping("/get/id")
    public Product getById(@RequestParam(value = "productID") int productID) {
        return productService.getById(productID);
    }

    /**
     * 根据产品代码获取产品
     * @param productCode
     * @return
     */
    @GetMapping("/get/code")
    Product getByCode(@RequestParam("productCode") String productCode){
        return productService.getByCode(productCode);
    }
}
